@extends('content.layouts.default')
@section('content')
    <div class="card">
        <div class="card-body">
            <ul class="nav nav-tabs nav-overflow header-tabs">
                <li class="nav-item">
                    <a href="{{route('content.articlemodel.index')}}" class="nav-link pb-3 ">
                        文章列表
                    </a>
                </li>
                <li class="nav-item">
                    <a href="{{route('content.articlemodel.create')}}" class="nav-link pb-3 active">
                        选择发表的文章栏目
                    </a>
                </li>
            </ul>
        </div>
        <div class="card-body">
            <div class="form-group">
                <label>选择发表栏目</label>
                <select name="parent_id" class="form-control" size="15">
                    @foreach($categorys as $category)
                        <option value="{{$category['id']}}">
                            {{$category['_title']}}({{$category->contentModel->title}})
                        </option>
                    @endforeach
                </select>
            </div>
        </div>
    </div>
@endsection
@push('js')
    <script>
        require(['jquery'], function ($) {
        $("[name=parent_id]").change(function () {
            let category_id = $(this).val();
            location.href = "{{route('content.articlemodel.create')}}?category_id=" + category_id;
        })
        })
    </script>
@endpush